﻿<phone:PhoneApplicationPage 
    x:Class="BookCaching.Pages.BookDetailPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:customControls="clr-namespace:BookCaching.CustomControls"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    mc:Ignorable="d" d:DesignHeight="696" d:DesignWidth="480"
    shell:SystemTray.IsVisible="True">

    <toolkit:TransitionService.NavigationInTransition>
        <toolkit:NavigationInTransition>
            <toolkit:NavigationInTransition.Backward>
                <toolkit:SlideTransition Mode="SlideDownFadeIn"/>
            </toolkit:NavigationInTransition.Backward>
            <toolkit:NavigationInTransition.Forward>
                <toolkit:SlideTransition Mode="SlideUpFadeIn"/>
            </toolkit:NavigationInTransition.Forward>
        </toolkit:NavigationInTransition>
    </toolkit:TransitionService.NavigationInTransition>

    <toolkit:TransitionService.NavigationOutTransition>
        <toolkit:NavigationOutTransition>
            <toolkit:NavigationOutTransition.Backward>
                <toolkit:SlideTransition Mode="SlideUpFadeOut"/>
            </toolkit:NavigationOutTransition.Backward>
            <toolkit:NavigationOutTransition.Forward>
                <toolkit:SlideTransition Mode="SlideDownFadeOut"/>
            </toolkit:NavigationOutTransition.Forward>
        </toolkit:NavigationOutTransition>
    </toolkit:TransitionService.NavigationOutTransition>

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="{Binding Source={StaticResource CurrentSettings}, Path=BackgroundColor, Mode=TwoWay}">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!--TitlePanel contains the name of the application and page title-->
        <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
            <TextBlock x:Name="ApplicationTitle"
                       Text="{Binding ConverterParameter=ApplicationTitle, Converter={StaticResource LocalizedStrings}, Source={StaticResource LocalizedStrings}}" 
                       Style="{StaticResource PhoneTextNormalStyle}"
                       Foreground="{Binding Source={StaticResource CurrentSettings}, Path=ForegroundColor, Mode=TwoWay}" />
            <TextBlock x:Name="PageTitle"                       
                       Text="{Binding ConverterParameter=BookDetailPageTitle, Converter={StaticResource LocalizedStrings}, Source={StaticResource LocalizedStrings}}" 
                       Margin="9,-7,0,0" 
                       Style="{StaticResource PhoneTextTitle1Style}"
                       Foreground="{Binding Source={StaticResource CurrentSettings}, Path=ForegroundColor, Mode=TwoWay}" />
        </StackPanel>

        <!--ContentPanel - place additional content here-->
        <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
            <Grid.RowDefinitions>
                <RowDefinition Height="auto" />
                <RowDefinition Height="*" />
                <RowDefinition Height="auto" />
                <RowDefinition Height="auto" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="auto" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
                
            <Image x:Name="coverImage" 
                    Grid.Row="0" 
                    Grid.Column="0" 
                    Width="160" 
                    Height="220" 
                    Tap="CoverImage_Tap" />
            <TextBlock x:Name="bookTitle" 
                       Grid.Row="0" 
                       Grid.Column="1"
                       FontSize="40"
                       TextWrapping="Wrap"
                       Foreground="{Binding Source={StaticResource CurrentSettings}, Path=ForegroundColor, Mode=TwoWay}"/>
            <ScrollViewer Grid.Row="1" 
                            Grid.Column="0"
                            Grid.ColumnSpan="2">
                <StackPanel>                    
                    <TextBlock x:Name="authorLabel" 
                                Foreground="{Binding Source={StaticResource CurrentSettings}, Path=ForegroundColor, Mode=TwoWay}"                                
                                Text="{Binding ConverterParameter=AuthorLabel, Converter={StaticResource LocalizedStrings}, Source={StaticResource LocalizedStrings}}" 
                                TextAlignment="Left" />
                    <TextBlock x:Name="authorText" 
                               TextAlignment="Left" 
                               TextWrapping="Wrap"
                               Foreground="{Binding Source={StaticResource CurrentSettings}, Path=ForegroundColor, Mode=TwoWay}" />

                    <TextBlock x:Name="publishedYearTitle" 
                               Foreground="{Binding Source={StaticResource CurrentSettings}, Path=ForegroundColor, Mode=TwoWay}"
                               Text="{Binding ConverterParameter=PublishedYearTitle, Converter={StaticResource LocalizedStrings}, Source={StaticResource LocalizedStrings}}" 
                               TextAlignment="Left" />
                    <TextBlock x:Name="publishedYearText" 
                               TextAlignment="Left"
                               Foreground="{Binding Source={StaticResource CurrentSettings}, Path=ForegroundColor, Mode=TwoWay}"/>
                    
                    <TextBlock x:Name="infoTitle" 
                                Foreground="{Binding Source={StaticResource CurrentSettings}, Path=ForegroundColor, Mode=TwoWay}"
                                Text="{Binding ConverterParameter=InfoTitle, Converter={StaticResource LocalizedStrings}, Source={StaticResource LocalizedStrings}}" 
                                TextAlignment="Left" />
                    <TextBlock x:Name="infoText" 
                                TextAlignment="Left" 
                                TextWrapping="Wrap"
                               Foreground="{Binding Source={StaticResource CurrentSettings}, Path=ForegroundColor, Mode=TwoWay}"/>
                    <TextBlock x:Name="addedByLabel"
                            Foreground="{Binding Source={StaticResource CurrentSettings}, Path=ForegroundColor, Mode=TwoWay}"
                            Text="{Binding ConverterParameter=AddedByLabel, Converter={StaticResource LocalizedStrings}, Source={StaticResource LocalizedStrings}}" 
                            TextAlignment="Left" />
                    <TextBlock x:Name="addedByText"
                            TextAlignment="Left" 
                            TextWrapping="Wrap"
                               Foreground="{Binding Source={StaticResource CurrentSettings}, Path=ForegroundColor, Mode=TwoWay}"/>
                    <TextBlock x:Name="currentLocationLabel"
                            Foreground="{Binding Source={StaticResource CurrentSettings}, Path=ForegroundColor, Mode=TwoWay}"
                            Text="{Binding ConverterParameter=CurrentLocationLabel, Converter={StaticResource LocalizedStrings}, Source={StaticResource LocalizedStrings}}" 
                            TextAlignment="Left" />
                    <TextBlock x:Name="currentLocationText"
                            TextAlignment="Left"
                            TextWrapping="Wrap"
                               Foreground="{Binding Source={StaticResource CurrentSettings}, Path=ForegroundColor, Mode=TwoWay}"/>
                </StackPanel>
            </ScrollViewer>
        </Grid>
    </Grid>
    
    <!--Sample code showing usage of ApplicationBar-->
    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True"
                              IsMenuEnabled="True">
            <shell:ApplicationBarIconButton x:Name="showOnMapButton"
                                            Click="ShowOnMapButton_Click"
                                            IconUri="/Images/AppbarIcons/appbar.marker.rest.png" 
                                            Text="blabla"/>
            <shell:ApplicationBarIconButton x:Name="findBookButton"
                                            Click="FindBookButton_Click"
                                            IconUri="/Images/AppbarIcons/appbar.add.rest.png"
                                            Text="blabla2"/>
            <shell:ApplicationBarIconButton x:Name="returnBookButton"
                                            Click="ReturnBookButton_Click"
                                            IconUri="/Images/AppbarIcons/appbar.download.rest.png"
                                            Text="blabla2"/>
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>

</phone:PhoneApplicationPage>
